Semiconductor devices are sometimes formed in wells, for example n-type wells formed in p-type substrates, which provides a degree of insulation from the substrate. The well and the substrate form a pn junction. However, in some cases voltages may be applied to the thus formed device, to the well or to the substrate which may cause a breakdown of the pn junction, which in turn may lead to a high breakdown current flowing. Such a current may lead to damage of the device.